# 定义函数 binary_search 接受参数 list_sort, size, targer，并将查找结果返回
def binary_search(list_sort, size, targer):
    low=0
    high=size-1
    while low<high:
        mid=int((low+high)/2)
        search=list_sort[mid]
        if search==targer:
            return mid
        elif search>targer:
            high=mid-1
        else:
            low=mid+1
    return -1
list_sort = [1,2,3,4,5,6,7,8,9,10]
targer = 3
print(binary_search(list_sort, len(list_sort), targer))